package com.sy.structural.adapter.clazz;

import com.sun.java.accessibility.util.Translator;
import com.sy.structural.adapter.Player;
import com.sy.structural.adapter.Zh_JPTranslate;

/**
 * 继承的方式合并 类结构模型
 * 通过继承方式适配转换了翻译器的功能
 */
public class JPMoviePlayerAdapter extends Zh_JPTranslate implements Player {

    private Player player;

    public JPMoviePlayerAdapter(Player target) {
        player = target;
    }

    @Override
    public String play() {
        // 播放后返回字母
        String context = player.play();
        // 翻译字幕
        String translate = translate(context);
        return translate;
    }
}
